<?php

class rss{
    private $rss;
    
    function __construct($array){
        $this->initializeRSS();
        $this->add($array);
        $this->end();
        return $this->rss;
    }
    
    private function initializeRSS(){
        $this->rss = '<rss version="2.0">\n\r 
                        <channel>'; 
    }
    
    private function add($array){
        foreach($array as $a){
            $this->rss .= '<item>\n\r<title>'.$a['title'].'<title>\n\r';
            $this->rss .= '<description>'.$a['description'].'<description>\n\r';
            $this->rss .= '<link>'.$a['link'].'<link>\n\r<item>\n\r';
        }
    }

    private function end(){
        $this->rss = '</channel>\n\r
                        </rss>';
    }
}
?>